package com.rd.student.dashuju.zhengruixian.test0725;

import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

public class TestJoin extends Thread{
    public TestJoin(String name){
        super(name);
    }
    @Override
    public void run(){
        for(int i=0;i<50;i++){
            System.out.println(getName()+" "+i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        new TestJoin("Thread1").start();
        for (int i=0;i<50;i++){
            if (i==20){
                TestJoin thread22=new TestJoin("thread22");
                thread22.start();
                thread22.join();
            }
            System.out.println(Thread.currentThread().getName()
            +" "+i);
        }
    }

}
